package com.estate.struts.actions;

import com.estate.business.LoginService;
import com.estate.utils.EncodeUtil;
import com.estate.vo.Vo;
import com.estate.vo.impl.UserInfoVo;

public class LoginAction extends EstateSupport {

	private LoginService loginService;
	private String loginName;
	private String password;
	@Override
	public String execute() throws Exception {
		String result = "fail";
		UserInfoVo user = new UserInfoVo();
		user.setLoginName(this.getLoginName());
		user.setPassword(this.getPassword());
		
		UserInfoVo userInfo = loginService.validate(user);
		if(userInfo != null){
			this.setSessionUser(userInfo);
			result = this.SUCCESS;
		}
		return result;
	}
	public String getLoginName() {
		return loginName;
	}
	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		
		this.password = password;
	}
	public LoginService getLoginService() {
		return loginService;
	}
	public void setLoginService(LoginService loginService) {
		this.loginService = loginService;
	}
}
